package com.bw.mapper;

import com.bw.bean.Vo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface Vomapper {
    //9） 查询订单的总价格，编写正确sql的语句（5分）
    //10） 查询各货物的销售总额的占比，编写正确sql的语句（5分）
    //11） 查询各省份的销售总额，编写正确sql的语句
@Select("select sum(price) from orderinfo")
    Double getlist1();
@Select("select b.name,sum(oi.price) 'value' from orderinfo oi\n" +
        "left join baseprovince b on oi.province_id = b.id\n" +
        "group by b.name")
    List<Vo> getlist2();
@Select("select ca.cargo_name 'name',sum(o.price)/(select sum(price) from orderinfo) 'value' from cargo ca\n" +
        "left join orderinfo o on ca.order_id = o.order_id\n" +
        "group by ca.cargo_name")
    List<Vo> getlist3();
}
